package org.esprit.ocm.client.rpc.ec2;

import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

public interface RegionServiceAsync
{

    /**
     * GWT-RPC service  asynchronous (client-side) interface
     * @see org.esprit.ocm.client.rpc.ec2.RegionService
     */
    void listRegions( org.esprit.ocm.dto.impl.ServerDto server, org.esprit.ocm.dto.impl.AwsCredentialsDto credentials, AsyncCallback<java.util.List<org.esprit.ocm.model.ec2.RegionMapping>> callback );


    /**
     * Utility class to get the RPC Async interface from client-side code
     */
    public static final class Util 
    { 
        private static RegionServiceAsync instance;

        public static final RegionServiceAsync getInstance()
        {
            if ( instance == null )
            {
                instance = (RegionServiceAsync) GWT.create( RegionService.class );
                ServiceDefTarget target = (ServiceDefTarget) instance;
                target.setServiceEntryPoint( GWT.getModuleBaseURL() + "RegionService.rpc" );
            }
            return instance;
        }

        private Util()
        {
            // Utility class should not be instanciated
        }
    }
}
